<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>简历管理</title>

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<link rel="stylesheet" type="text/css" href="css/jquery-ui-1.8.16.custom.css" />
<link rel="stylesheet" type="text/css" href="css/validator.css" />
<link rel="stylesheet" href="css/howitworks.css" />
<link rel="stylesheet" href="css/common.css" />
<link rel="stylesheet" href="css/pixie.css" />

<style type="text/css" title="currentStyle">
@import "css/demo_page.css";

@import "css/demo_table.css";
@import "css/jquery-ui-1.8.16.custom.css";
</style>

<script type="text/javascript" language="javascript" src="js/jquery-1.6.4.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.dataTables.js"></script>

<script type="text/javascript" language="javascript" src="js/jquery.bgiframe-2.1.2.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.core.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.widget.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.mouse.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.button.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.draggable.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.position.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.resizable.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.dialog.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.effects.core.js"></script>
	
<style>
	body { font-size: 62.5%; }
	input.text { margin-bottom:12px; width:95%; padding: .4em; }
	fieldset { padding:0; border:0; margin-top:25px; }
	h1 { font-size: 1.2em; margin: .6em 0; }
	div#users-contain { width: 350px; margin: 20px 0; }
	div#users-contain table { margin: 1em 0; border-collapse: collapse; width: 100%; }
	div#users-contain table td, div#users-contain table th { border: 1px solid #eee; padding: .6em 10px; text-align: left; }
	.ui-dialog .ui-state-error { padding: .3em; }
	.validateTips { border: 1px solid transparent; padding: 0.3em; }
</style>
	
<% 
String permLevel = session.getAttribute( "perm-level") == null ? "0" : session.getAttribute( "perm-level").toString(); 
%>

<script type="text/javascript" charset="utf-8">

window.onbeforeunload = function()
{
	if(Math.abs(event.clientX - document.body.clientWidth) < 30)
	{
		if (confirm('确实要退出简历管理？'))
			window.location.href("login.action");
		else
			event.returnValue = '请点取消留在本页面！';
	}
}

$(document).ready(function() {
	$("#mode").val(0);
	$("#delResume").button();
	$("#rollbackResume").button();
	$("#backupResume").button();
	$("#recoveryResume").button();
	$('#deleteString').val('');
	permControl();
	
    $('#searchRes').dataTable( {
    	"bAutoWidth": false,
    	"bJQueryUI": false,
    	"iDisplayLength": 15,
    	"aLengthMenu": [15, 25, 50],
    	//"sAjaxSource": "sources/arrays.txt",
        "sPaginationType": "full_numbers",
        	"aoColumns": [
			{ "bVisible": false, "asSorting": [ "desc" ] },
			null,
			null,
			null,
			null,
			null,
			null,
			null,
			null,
			null
			]
    }
    );
    
    if (document.getElementById("xlsFileLocatoin").value != null && document.getElementById("xlsFileLocatoin").value != "") {
    	$( "#downloadDialog" ).dialog({
			autoOpen: true,
			modal: true,
			buttons: {
				"取 消": function() {
					$( this ).dialog( "close" );
				}
			},
			close: function() {
			}
		});
    	document.getElementById("downloadXls").href="${ctx}" + "/" + document.getElementById("xlsFileLocatoin").value;
    } else {
    	$("#downloadXls").hide();
    }
} );

function openNew() {
	window.open ('page.html', 'newwindow', 'fullscreen')
}

</script>

<script>
	$(function() {
		// a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
		$( "#dialog:ui-dialog" ).dialog( "destroy" );
		
		function updateTips( t ) {
			tips
				.text( t )
				.addClass( "ui-state-highlight" );
			setTimeout(function() {
				tips.removeClass( "ui-state-highlight", 1500 );
			}, 500 );
		}

		function checkLength( o, n, min, max ) {
			if ( o.val().length > max || o.val().length < min ) {
				o.addClass( "ui-state-error" );
				updateTips( "Length of " + n + " must be between " +
					min + " and " + max + "." );
				return false;
			} else {
				return true;
			}
		}

		function checkRegexp( o, regexp, n ) {
			if ( !( regexp.test( o.val() ) ) ) {
				o.addClass( "ui-state-error" );
				updateTips( n );
				return false;
			} else {
				return true;
			}
		}
		
		$( "#dialog-form" ).dialog({
			autoOpen: false,
			height: 600,
			width: 650,
			modal: true,
			buttons: {
				"搜 索": function() {
					$("#isDeleteMode").val(1);
					document.getElementById("resume-list").submit();
					$( this ).dialog( "close" );
				},
				"清空搜索条件": function() {
					$("#typeOfWork").val("");
					$("#name").val("");
					$("#nationality").val("");
					$("#corporation").val("");
					$("#position").val("");
					$("#industry").val("");
					$("#sex").val("");
					$("#workSeniority").val("");
					$("#workingPlace").val("");
				},
				"取 消": function() {
					$( this ).dialog( "close" );
				}
			},
			close: function() {
			}
		});
	});
	
	function permControl() {
		var permLevel = <%=permLevel%>;
		if (permLevel % 10 < 1) {
			$( "#createResume" ).hide();
		}
		if ((permLevel % 100000) / 10000 < 1) {
			$( "#userList" ).hide();
		}
		if ((permLevel % 1000000) / 100000 < 1) {
			$( "#userList" ).hide();
		}
		if ((permLevel % 10000000) / 1000000 < 1) {
			$( "#userList" ).hide();
		}
	}
	
	function openSearchDailog() {
		$( "#dialog-form" ).dialog( "open" );
	}
	function backupResumeFun() {
		$("#isWriteXlsMode").val(1);
		document.getElementById("resume-filter").submit();
	}
	
	function deleteResmue() {
		if (window.confirm("是否要删除这些简历?"))
		{
			document.getElementById("isDeleteMode").value = 1;
			document.getElementById("resume-mananger").submit();
		}
	}
	function rollbackResmue() {
		if (window.confirm("是否要还原这些简历?"))
		{
			document.getElementById("isDeleteMode").value = 2;
			document.getElementById("resume-mananger").submit();
		}
	}
	
	function changeDelete(param) {
		if (param.checked) {
			document.getElementById("deleteString").value = document.getElementById("deleteString").value + param.id + ";";
		} else {
			var str = document.getElementById("deleteString").value;
			document.getElementById("deleteString").value = str.replace(param.id + ";", "");
		}
	}
</script>
</head>
<body  id="dt_example">
<div class="top_bar">
	<ul class="nav">
		<li><span class="SayHi">欢迎: 
			<%=session.getAttribute("username")%>
		</span>
		</li>
		<li id="search">
			<a href="/resume/resume-main.action?page=0&pageSize=10">返回首页</a>
		</li>
		<li id="search">
			<a href="/resume/resume-list.action">搜索简历</a>
		</li>
		<li id="createResume">
			<a href="/resume/resume-insert.action">新建简历</a>
		</li>
		<li id="userList">
			<a href="/resume/user-list.action">用户列表</a>
		</li>
		<li id="createUser">
			<a href="/resume/user-create.action">新建用户</a>
		</li>
		<li id="userList">
			<a href="/resume/audit-list.action?page=0&pageSize=20">日志</a>
		</li>
		<li>
			<a href="/resume/login.action">退出</a>
		</li>
	</ul>
</div>
<br />
<br />
	<div id="container" style="float:left; margin-left:10px;">
		<s:form id="resume-mananger" action="resume-manager" method="post">
				<table cellpadding="0" cellspacing="0" border="0" class="display"
					id="searchRes">
					<thead>
						<tr>
							<th>ID</th>
							<th>姓名</th>
							<th>公司名称</th>
							<th>职位名称</th>
							<th>性别</th>
							<th>年龄</th>
							<th>目前工作地点</th>
							<th>所属行业</th>
							<th>状态</th>
							<th>删除</th>
						</tr>
					</thead>
					<tbody>
						<s:iterator value="resumeList" id="content" status="st">
							<tr>
								<td><s:property value='#st.index' /></td>
								<td>
									<s:url id="url_user" value="/resume-review.action">
										<s:param name="resumeId" value="%{#content.resume.id}"></s:param>
										<s:param name="type" value="1"></s:param>
									</s:url> 
									<s:a href="%{url_user}" target="_blank">
										<s:property value="%{#content.resume.name}" />
									</s:a>
								</td>
								<td><s:property value="%{#content.resume.corporation}" /></td>
								<td><s:property value="%{#content.resume.position}" /></td>
								<td><s:property value="%{#content.resume.sex}" /></td>
								<td><s:property value="%{#content.resume.dateOfBirth}" /></td>
								<td><s:property value="%{#content.resume.workingPlace}" /></td>
								<td><s:property value="%{#content.resume.industry}" /></td>
								<td><s:property value="%{#content.state}" /></td>
								<td>
									<s:checkbox id="%{#content.resume.id}" name="" value="false" theme="simple" onclick="changeDelete(this)"/>
								</td>
							</tr>
						</s:iterator>
					</tbody>
					<tfoot>
						<tr>
							<th>ID</th>
							<th>姓名</th>
							<th>公司名称</th>
							<th>职位名称</th>
							<th>性别</th>
							<th>年龄</th>
							<th>目前工作地点</th>
							<th>所属行业</th>
							<th>状态</th>
							<th>删除</th>
						</tr>
					</tfoot>
				</table>
				<s:hidden id="isDeleteMode" name="isDeleteMode"></s:hidden>
				<s:hidden id="deleteString" name="deleteString"></s:hidden>
		</s:form>
	</div>
	<div style="text-align:center">
		<h2>
			<input type="button" id="delResume" onclick="deleteResmue()" value="删 除 简 历"/>&nbsp;&nbsp;&nbsp;&nbsp;
			<input type="button" id="rollbackResume" onclick="rollbackResmue()" value="恢 复 简 历"/>&nbsp;&nbsp;&nbsp;&nbsp;
			</h2>
			</div>
	
<div id="searchDiv" style="disply: none">
	<div id="dialog-form" title="">
		<s:form id="resume-list" action="resume-list" method="post" theme="simple">
		<fieldset>
			<label for="name" style="display:block;">姓名:</label>
			<s:textfield id="name" label="姓名:" name="resume.name" size="35" theme="simple" cssClass="text ui-widget-content ui-corner-all"/>
			<label for="corporation" style="display:block;">公司名称:</label>
			<s:textfield id="corporation" theme="simple" label="公司名称" name="resume.corporation" cssClass="text ui-widget-content ui-corner-all"/>
			<label for="position" style="display:block;">职位名称:</label>
			<s:textfield id="position" theme="simple" label="职位名称" name="resume.position" cssClass="text ui-widget-content ui-corner-all" />
			<label for="industry" style="display:block;">所属行业:</label>
			<s:select id="industry" label="所属行业" theme="simple" headerKey="" headerValue="请选择" cssClass="select_lr lr_rd"
								name="resume.industry" size="1" style="overflow-y:auto;"
								list="#{
'餐饮业':'餐饮业',
'广告':'广告',
'文字媒体/出版':'文字媒体/出版',
'机械/设备/重工':'机械/设备/重工',
'印刷/包装/造纸':'印刷/包装/造纸',
'采掘业/冶炼':'采掘业/冶炼',
'娱乐/休闲/体育':'娱乐/休闲/体育',
'法律':'法律',
'石油/化工/矿产/地质':'石油/化工/矿产/地质',
'环保':'环保',
'交通/运输/物流':'交通/运输/物流',
'批发/零售':'批发/零售',
'教育/培训/院校':'教育/培训/院校',
'学术/科研':'学术/科研',
'房地产开发':'房地产开发',
'生活服务':'生活服务',
'政府/公共事业':'政府/公共事业',
'农/林/牧/渔':'农/林/牧/渔',
'其他行业':'其他行业',
'通信/电信/网络设备':'通信/电信/网络设备',
'互联网/电子商务':'互联网/电子商务',
'汽车及零配件':'汽车及零配件',
'中介服务':'中介服务',
'仪器仪表/工业自动化':'仪器仪表/工业自动化',
'电力/水利':'电力/水利',
'计算机硬件':'计算机硬件',
'计算机服务(系统、数据服务、维修)':'计算机服务(系统、数据服务、维修)',
'通信/电信运营':'通信/电信运营',
'增值服务':'增值服务',
'网络游戏':'网络游戏',
'会计/审计':'会计/审计',
'银行':'银行',
'保险':'保险',
'家具/家电/工艺品/玩具/珠宝':'家具/家电/工艺品/玩具/珠宝',
'办公用品及设备':'办公用品及设备',
'医疗/护理/卫生':'医疗/护理/卫生',
'医疗设备/器械':'医疗设备/器械',
'公关/市场推广/会展':'公关/市场推广/会展',
'影视/媒体/艺术/文化传播':'影视/媒体/艺术/文化传播',
'家居/室内设计/装潢':'家居/室内设计/装潢',
'物业管理/商业中心':'物业管理/商业中心',
'检测，认证':'检测，认证',
'酒店/旅游':'酒店/旅游',
'美容/保健':'美容/保健',
'航天/航空':'航天/航空',
'原材料和加工':'原材料和加工',
'非盈利机构':'非盈利机构',
'多元化业务集团公司':'多元化业务集团公司',
'外包服务':'外包服务',
'奢侈品/收藏品':'奢侈品/收藏品',
'新能源':'新能源',
'计算机软件':'计算机软件',
'电子技术/半导体/集成电路':'电子技术/半导体/集成电路',
'金融/投资/证券':'金融/投资/证券',
'贸易/进出口':'贸易/进出口',
'快速消费品(食品、饮料、化妆品)':'快速消费品(食品、饮料、化妆品)',
'服装/纺织/皮革':'服装/纺织/皮革',
'制药/生物工程':'制药/生物工程',
'建筑/建材/工程':'建筑/建材/工程',
'专业服务(咨询、人力资源、财会)':'专业服务(咨询、人力资源、财会)'
}" />
			<label for="sex" style="display:block;">性别:</label>
			<s:select id="sex" label="性别" theme="simple" headerKey="" cssClass="select_lr lr_rd" headerValue="请选择" name="resume.sex" list="#{'男':'男','女':'女'}" />
			<label for="workingPlace" style="display:block;">目前工作地点:</label>
			<s:textfield id="workingPlace" theme="simple" label="目前工作地点" name="resume.workingPlace" cssClass="text ui-widget-content ui-corner-all" />
		</fieldset>
		
		<s:hidden id="xlsFileLocatoin" name="xlsFileLocatoin"></s:hidden>
		</s:form>
	</div>
</div>

<div id="downloadDialog" title="" style="disply: none">
	<s:a theme="simple" id="downloadXls" href="">点击下载Excel</s:a>
</div>
</body>
</html>